﻿using System;
using System.Collections.Generic;

namespace Website.Models.ModelMetadata
{
    public class Pager
    {
        public IEnumerable<Product> Products { get; set; }
        public int ItemPerPage { get; set; }
        public int CurrentPage { get; set; }
        public int TotalItem { get; set; }
        public int CategoryID { get; set; }
        public string Search { get; set; }
        public int LastPage
        {
            get { return (int)Math.Ceiling((decimal)TotalItem / ItemPerPage); }
        }
        public bool IsFirst { get { return CurrentPage == 1; } }
        public bool IsLast { get { return CurrentPage == LastPage; } }
        public bool HasPrevious { get { return CurrentPage >= 2; } }
        public bool HasNext { get { return CurrentPage < LastPage; } }
    }
}